import React from 'react'
import { useLoaderData } from 'react-router-dom'
import { getSwiperApi } from '../../api/lun'
import { ResultPage, Card } from 'antd-mobile'
import Myswiper from '../../components/Myswiper'
import Myhome from './components/Myhome'
import Hoc from '../../shou/Hoc'
function Index() {
  const loaderData=useLoaderData()
  return (
    <div>
       <ResultPage
      status=''
      title='火车票预订'
      description='便捷购票,服务您的每一次出行'
    >
      <ResultPage.Card style={{  padding: 8 }}>
       <Myhome/>
      </ResultPage.Card>

    <Myswiper list={loaderData.swioper}/>

    </ResultPage>
    </div>
  )
}

export default Hoc(Index)

export const loader=async()=>{
  const {data:res}=await getSwiperApi()
  return{swioper:res}
}
